package com.example.service.impl;

import com.example.mapper.PermissionsMapper;
import com.example.pojo.Permissions;
import com.example.service.PermissionsService;
import com.example.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Service
public class PermissionsServiceImpl implements PermissionsService {
    @Autowired
    private PermissionsMapper permissionsMapper;

    @Override
    public void realName(Permissions permissions, HttpServletRequest request) {
        permissions.setIdU(JwtUtils.parseJWT(request.getHeader("token")).get("id", Integer.class));
        permissionsMapper.realName(permissions);
    }
}
